import requests from '@/utils/request-proxy'

//获取SPU列表数据
export const reqGetSpuList = (page, limit, category3Id) => requests({ url: `/admin/product/${page}/${limit}`, method: 'get', params: { category3Id } })

//获取品牌数据  
export const reqGetTradeMarkListInfo = () => requests({ url: `/admin/product/baseTrademark/getTrademarkList`, method: 'get' })

//获取平台中的全部销售属性  
export const reqGetBaseSaleAttrListInfo = () => requests({ url: `/admin/product/baseSaleAttrList`, method: 'get' })

//获取某一个SPU信息   
export const reqGetSpuInfoById = (spuId) => requests({ url: `/admin/product/getSpuById/${spuId}`, method: 'get' })

//获取spu图片
export const reqGetSpuImageInfoById = (spuId) => requests({ url: `/admin/product/spuImageList/${spuId}`, method: 'get' })

//添加或修改spu
export const addorUpdateSpuInfo = (spuInfo) => {
    if (spuInfo.id) {
        return requests({ url: `/admin/product/updateSpuInfo`, method: 'post', data: spuInfo })
    } else {
        return requests({ url: `/admin/product/saveSpuInfo`, method: 'post', data: spuInfo })
    }
}

//删除spu
export const reqDeleteSpu = (spuId) => requests({ url: `/admin/product/deleteSpu/${spuId}`, method: 'delete' })

//添加sku
export const reqAddSkuInfo = (data) => requests({ url: `/admin/product/saveSkuInfo`, method: "post", data })

//获取sku列表数据
export const reqFindSkuInfoById = (spuId) => requests({ url: `/admin/product/findBySpuId/${spuId}`, method: 'get' })